package DataStructureAndAlgorithm.AcWing_每日一题.贪心题;

//链接：https://www.acwing.com/problem/content/3809/

import java.util.Scanner;
public class AcWing_3806 {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int t = in.nextInt();
        for (int k = 0; k < t; k++){
            int n = in.nextInt();
            String str = in.next();
            boolean flag = false;
            for (int i = 0; i < n - 1; i++){
                //前一个比后一个小，则不能删，否则字典序会变大
                if (str.charAt(i) > str.charAt(i + 1)){
                    flag = true;
                    str = str.substring(0,i) + str.substring(i + 1,n);
                    break;
                }
            }
            //如果字典序是一直递增或者一直不变的，则删除最后一个即可
            if (!flag)str = str.substring(0,n - 1);
            System.out.println(str);
        }
        in.close();
    }
}
